home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Inspectors / NewInspector / NewInspector.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  130 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "NewInspector.h"
  5. #import <appkit/Box.h>
  6. #import <appkit/Button.h>
  7. #import <appkit/PopUpList.h>
  8. #import <appkit/Matrix.h>
  9.  
  10. @implementation NewInspector
  11.  
  12. static id theInspector = nil;
  13.  
  14. /* makes sure there is only one instantiation of this object */
  15. + new
  16. {
  17.     if (!theInspector) {
  18.         theInspector = self = [super new];
  19.         [NXApp loadNibSection:"NewInspector.nib" owner:self];
  20.         [self init];
  21.     } else
  22.         self = theInspector;
  23.         
  24.     return self;
  25. }
  26.  
  27. -init
  28. {
  29.     //[super init];
  30.         
  31.     ViewsList = [[List alloc] init];
  32.     SupervisorList = [[List alloc] init];
  33.     
  34.     
  35.     thePopUpList = [thePopUpListButton target];
  36.     [thePopUpList setTarget:self];
  37.     [thePopUpList setAction:@selector(toggleInspectorPanels:)];
  38.     [thePopUpList removeItemAt:0];  
  39.     /* IB comes up with atleast one item in the popupList. We do this to get rid of that.*/
  40.     
  41.     return self;
  42. }
  43.  
  44. -inspectorPanel
  45. {
  46.     return InspectorPanel;
  47. }
  48.  
  49. -free
  50. {
  51.     [ViewsList free];
  52.     [SupervisorList free];
  53.     [InspectorPanel orderOut:self];
  54.     return [super free];
  55. }
  56. - orderFrontPanel:sender
  57. {
  58.     [InspectorPanel orderFront:self];
  59.     return self;
  60. }
  61. - orderBackPanel:sender
  62. {
  63.     [InspectorPanel orderBack:self];
  64.     return self;
  65. }
  66.  
  67. -setTitle:(char *)theTitle
  68. {
  69.     [InspectorPanel setTitle:theTitle];
  70.     return self;
  71. }
  72. -addView:(id)aView withName:(char *)Name withSupervisor:(id)aSupervisor
  73. {
  74.     [ViewsList addObject:aView];
  75.     [SupervisorList addObject:aSupervisor];
  76.     
  77.     [thePopUpList addItem:Name];
  78.     
  79.     [InspectorBox setContentView:aView];
  80.     [InspectorBox display];
  81.     
  82.     [thePopUpListButton setTitle:Name];
  83.     return self;
  84. }
  85.  
  86. -remove:(char *)Name
  87. {
  88.     int    i;
  89.     
  90.     i = [thePopUpList indexOfItem:Name];
  91.     [thePopUpList removeItemAt:i];
  92.     [ViewsList removeObjectAt:i];
  93.     return self;
  94. }
  95.  
  96. -show:(char *)Name
  97. {
  98.     int    i;
  99.     
  100.     i = [thePopUpList indexOfItem:Name];
  101.     [thePopUpListButton setTitle:Name];
  102.     [InspectorBox setContentView:[ViewsList objectAt:i]];
  103.     [InspectorBox display];
  104.     return self;
  105.  
  106. }
  107.  
  108. -updateDisplay
  109. {
  110.     [InspectorBox display];
  111.     return self;
  112. }
  113. - windowDidUpdate:sender
  114. {
  115.     [SupervisorList makeObjectsPerform:@selector(windowDidUpdate:) with:sender];
  116.     return self;
  117. }
  118. -toggleInspectorPanels:sender
  119. {
  120.     int i;
  121.     
  122.     i = [sender selectedRow];
  123.     [InspectorBox setContentView:[ViewsList objectAt:i]];
  124.     [InspectorBox display];
  125.     return self;
  126. }
  127.  
  128.  
  129. @end
  130.